package cn.tedu.serializable;

import java.io.Serializable;

/**
 * @author :Colin
 * @version 创建时间: 2021/6/18 10:32
 */
/*本类用于封装学生类*/
/*如果本类想要序列化，必须实现序列化化接口Serializable，否则报错
报错信息java.op.noSerializableException:cn.tedu.serializable.
serializable是一个空接口，一个方法都没有
是实现这个接口是为了作为一个标志，标志本类可以被序列化
 */
public class Student implements Serializable {
        private String name;
        private int age;
        private String addr;
        private char gender;
        //private static final long serialVersionUID=1l;
//2.1生成无参构造，必须手动生成无参构造，因为有参构造会自动覆盖它
    public Student() {
        System.out.println("我是student无参构造");
    }//这个无参构造没有用过啊？？

    public Student(String name, int age, String addr, char gender) {
        super();
        this.name = name;
        this.age = age;
        this.addr = addr;
        this.gender = gender;
        int a=8;


    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getAddr() {
        return addr;
    }

    public void setAddr(String addr) {
        this.addr = addr;
    }

    public char getGender() {
        return gender;
    }

    public void setGender(char gender) {
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", addr='" + addr + '\'' +
                ", gender=" + gender +
                '}';
    }
}
